<!-- extend base layout -->
{% extends "base.html" %}

{% block content %}
    <h1>{{ _('Hi, %(nickname)s!', nickname=g.user.nickname) }}</h1>
    {% include 'flash.html' %}
    <div class="well">
        <form class="form-horizontal" action="" method="post" name="post">
            {{ form.hidden_tag() }}
            <div class="control-group{% if form.post.errors %} error{% endif %}">
                <label class="control-label" for="post">{{ _('Say something:') }}</label>
                <div class="controls">
                    {{ form.post(size=30, maxlength=140) }}
                    {% for error in form.post.errors %}
                        <span class="help-inline">[{{ error }}]</span><br>
                    {% endfor %}
                </div>
            </div>
            <div class="control-group">
                <div class="controls">
                    <input class="btn btn-primary" type="submit" value="{{ _('Post!') }}">
                </div>
            </div>
        </form>
    </div>
    {% for post in posts.items %}
        {% include 'post.html' %}
    {% endfor %}
    <ul class="pager">
        {% if posts.has_prev %}
        <li class="previous"><a href="{{ url_for('index', page=posts.prev_num) }}">{{ _('Newer posts') }}</a></li>
        {% else %}
        <li class="previous disabled"><a href="#">{{ _('Newer posts') }}</a></li>
        {% endif %}
        {% if posts.has_next %}
        <li class="next"><a href="{{ url_for('index', page=posts.next_num) }}">{{ _('Older posts') }}</a></li>
        {% else %}
        <li class="next disabled"><a href="#">{{ _('Older posts') }}</a></li>
        {% endif %}
    </ul>
{% endblock %}
